package group.program.mapper;

import group.program.pojo.Dbstructure;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface DatabaseMapper {

    void addDatabase(Dbstructure dbstructure);

    /**
     * 删除数据库
     * @param did
     */
    @Delete("delete from dbstructure where did = #{did} and uid = #{uid}")
    void rmDatabase(Integer did,Integer uid);

    /**
     * 查询全部记录
     * @param uid
     * @return
     */
    List<Dbstructure> selectAll(Integer uid);

    /**
     * 查询单条记录
     * @param did
     * @param uid
     * @return
     */
    Dbstructure selectOne(Integer did,Integer uid);

    /**
     * 根据名称查询
     * @param name
     * @param uid
     * @return
     */
    List<Dbstructure> selectByName(String name, Integer uid);

    /**
     * 查询所有连接数据库的结构文件内容
     * @param uid
     * @return
     */
    List<String> selectDbStructure(Integer uid);
}
